import React from 'react';
import store from 'store'
import {withRouter, Redirect} from 'react-router-dom'
import config from '@UTILS/config'
import cookies from "js-cookie";

class WechatBaseLogin extends React.PureComponent {

    render() {

        let wechat_base_info_redirect_url = this.props.location.pathname
        if (!cookies.get('wechat_base_info_redirect_url')) {
            cookies.set('wechat_base_info_redirect_url', wechat_base_info_redirect_url)
            window.location.href = config.api.serviceUrl + '/wechat/user/login/base'
            return ''
        }else{
            cookies.remove('wechat_base_info_redirect_url')
            return this.props.children
        }

    }
}

export default withRouter(WechatBaseLogin)
